Fix column index

We need to detect correct column offset when group by clause contains other fields.
otherwise we correct wrong field.