Fix crash when data is nil