Fixed b0rken sql

Query wasn't executed correctly, resulting in b0rking page.