more accurate error checks