Remove out-of-bound access to vectors.
Merge pull request #25 from gwtnb/remove-out-of-bound-access

Remove out-of-bound access to vectors.