change the error checks slightly