Use file.copy instead of file.rename. Fixes #14