fixed index out of bounds errors
Merge pull request #14 from bretttolbert/master

fixed index out of bounds errors