replay: global variables and function stubs