correct error logic