Adjust the code of envelop.m