Optimized handling of kind UNDEFINED