fix bug causing excessive transfer length