fix query for tags to use join function