Fix logging order