fix applying data->env on error