fixed error logging