modified to initialize serialport