query fix and debug output added in tags navigation