Fixed a bug with regards to the querying of tags in the database