fix out of bounds exception
Merge pull request #47 from mlosch/master

fix out of bounds exception