Fixed file copy function to work with empty functions as well.