Fixed the list out of index bug.