Fix bugs in handling of nested functions.

Met when a function includes a function that includes a function...