CFY-1465 fix error handling