Fixed bugs in queries, missing column in schema