Fix a potential logging bug