Fixing the broken SQL query in #173.