Fix crash if nil value is added to an array