fix state error handler