Querying database works now