fixing minor bug with setting of envelope value