Fix "Undefined index: weight"