Add additional sanity checks (bug #3548)