serialport handling fixed, bug fixes