Fix copytree handling