Make setRef getRef aware of null values.