Correctly type nulls in the case when.