make sure StdFunction stack templates remove upvalue from stack when needed.