bug-29: use the first element when we have multiple elements queried for
base query.
Merge pull request #3 from john-hu/bug-29-infinite-loop

bug-29: use the first element when we have multiple elements queried for, r=thomas