Fixed out of index bug.