Improved stream API and wrapper integration fixing some bugs in the
process.