some error checking