Fix logging to file