support null and undefined for extend.