Added test for proper inner flow resolution.
Fixing bugs for failed flows