check in case data retrieval returns undefined.