Use the modulo() function instead of mod() to avoid zero indices (problem
reported by Eildert Groeneveld)
Authored by: arjenmarkus 2013-03-05
Parent: [r332]
Child: [r334]