fixed copy and rewrite move