a bug fix to prevent copying to a sub directory