fix out of bounds bug (off by 1 segfault)
Merge pull request #1 from flavio-fernandes/master

fix out of bounds bug (off by 1 segfault)