Fixed an undefined index bug.