fixed bug with closures