fix SQL results