Fixed getIndex calculation
Merge pull request #1 from murgo/master

Pulling in fix for getIndex calculation