Fix log file is empty when running as a daemon (#5)