mp_rational: make serialization method more robust against bad archives, and test the behaviour.