Add check for undefined