better handling of undefined data