Fixed the array access beyond bounds.
Merge pull request #308 from shu223/master

Fixed the array access beyond bounds.