added null check on print date function