Fixed a bug in _encode_mr().