Fix for #10656: __env__ should be passed around instead of env