fixed issues in writing to serial port