a little error checking