update error logic