fix grid operation when using leftToRight order