added reliable input stream wrapper