A few fixes to the pre-processing phase.
Fix to the handling of nested functions.
Added one more test case for nested functions.