Fixes the number of received bytes calculation in the input stream.