paranoid error checking