Fixed bug in SQL statement for new tags api