fixed envelope function
Fixed serial port code.