Fix a long-standing error logging bug