fix bug modifying original query in previous commit