add CAUSE encoding, with test