Fixed integer division in indices.

See issue #2918