Make logging more robust when there are null values