Improving errors handling