more complete error checking