fixed buffer underflow (throw eof exception instead)