rollback the ToFile func implement, and add testcase