We have already an environment in $env, no need to create a new one. Please also use $context as it contains potential used variables used in the filter.