Fix bug and reverse logfile