env_sf: updated to the new environment code