handle case when data is None