little bit of error checking