adds safety checking as an example for unmarshalling