rename fit_env_bd function to fit_env