Slight improvement to handling null values