fix indices for issue #39
Merge pull request #40 from MaxDaten/stack-space-overflow-fix

fix indices for issue #39