Fix bug in ModI sequence when I is a power of 2.