[api] Return new env in env_set