Array indexing: improved safety with modular arithmetic