Make decoding logic in validator more robust