It seems that these are not the same transform: invert(apply(x)) != Some(x).

Why aren't you doing something like: StringToCB(a.toString)?