fixed error check
fixed error check