Fix query unit tests