Fixed another bug in the copy method, added copyfile method in order to address the bug.