Query: add tests to verify that methods do not alter their parameter query; fix remove() that altered the parameter