fix bug for saving env with modem function inside