add find_last_stack and corresponding test