This seems to be a reasonable and well-written workaround for misbehaving RFC 8182 implementations.