some basic error checking.