Fix profiling of nested functions.