correct errors handling