Minor bug fix when read goes past end of stream.