Fix bug in copy's result
Generalize things a bit