fix error handling logging