more efficient unmarshal, fixed tests