Fixed index out of range error.
Merge pull request #7 from SlrG/master

Fixed index out of range error