Fixed a bug with the SQL datastore which prevented the database from running the alias as queries effectivley