Behavior is undefined using references with varargs

See http://stackoverflow.com/questions/15772134/can-i-delete-a-git-commit-but-keep-the-changes
Changed a few references to copies to avoid changing the API.
Fixed compiler warnings about "set" being ambiguous
Merge branch 'tickets/DM-1302'