Enable log to file and fix exam bug