Ruby-serialport dropped bytes

I am using ruby-serial port version 0.6 with cygwin on Windows XP.
The version of ruby is 1.8.5. With the test script miniterm.rb
supplied with ruby serial port the first 10 or so bytes are lost when
they are received. Any ideas anyone? The miniterm.rb script is:

if ARGV.size < 4
  STDERR.print <<EOF
  Usage: ruby #{$0} num_port bps nbits stopb
EOF
  exit(1)
end

sp = SerialPort.new(ARGV[0].to_i, ARGV[1].to_i, ARGV[2].to_i,
ARGV[3].to_i, SerialPort::NONE)

open("/dev/tty", "r+") { |tty|
  tty.sync = true
  Thread.new {
    while true do
      tty.printf("%c", sp.getc)
    end
  }
  while (l = tty.gets) do
    sp.write(l.sub("\n", "\r"))
  end
}

sp.close

Mark