Added a check for null data values