handle nil case for data