Improve errors handling