Fixed handling of Serial port