changed it so that a unit is only initialized if it is null