additional error checking on some database routines