Fixed and simplified logic behind 'composed' flag in FunctionInvocationWrapper and added additional test Resolves #429