fixing error logging