fixed stream to handle reads of < available data by restoring the previous position