copy to tmp before changing