a little more error checking