Fix possible message logging bug