undefined index bug fixed