Handle null values correctly (reported by Michael Igler).