added a little more error checking