fix index out of range error
Merge pull request #2 from meniku/topic/fix-out-of-range-er

fix index out of range error