Improve handling of null values