io.istream: fix exception thrown by read_all