fix bug and add test for StackFrame