replaced shutil.copy2 for os.rename