Fixes bug with lambdas inside functions