fixed minor bug for querying tags