added a bit of error checking