fix segmentation fault for null values