Handle undefined values as well