fixed a recursion issue in queryCollection