fix leaky variables
Merge pull request #1123 from rounce/leaky

fix leaky variables