Better handling of undefined values