Fix handling of undef return when --with-headers is specified