fix leaky variable declaration