Fixed logging bug