Check if a file exists before copying

Fixes #2