Fixed some bugs in changeset query code. Added more test cases.