fixed error logging to make sense