Fix SQL Queries