Fixed a bug that caused an undefined index warning introduced since the last commit.