"Undefined index" bug fixed