Undefined index error upon update fixed