Minor patch (flushing log file output at the end of program run)