More ancestor query tests and fixes