Fixing the sql.