Implement encode_undefined