fixed NPE
Merge pull request #75 from nagibcs/master

fixed IndexOutOfBounds exception