#1 fix error logging