Add tests and fix bug in which hash-set was not copied for destructive ops