Function within loop bug

This bug apparently occurs because we use caller_id, line and name to compose the key for grouping different activations of the same function call. But caller_id changes in each invocation. 

Using the complete namespace (line/name of all functions in the call stack) and the line/name of the current function as a key to identify functions will probably solve this bug.