better handling nil data