[minor] only add functions to the stack that will actually be called