Fixed a trashing error when dest file exists
Debug optimisations