Fix handling of undefined