Changed the way of preservation of query bindings
Added more tests