fix global leak from dirty refactor