Perform unwrapping and fix potential stack overflow in dualisation of
session types.