change the error checking