updated file copy logic, should close #3