fix the rewind issue with nonseekable streams