deep copying to try to avoid some bugs.