error checking working