validate error properly