Fixed: Wrong SQL queries