Fix handling of variables inside of lambdas