partly removed memory leak in replay