some more error checking