Fix crashes when non-streaming jars are used

This includes #637 (thanks to @ap-ensighten). In addition the PR adds tests and handles the scenario where steps with non streaming jars and streaming jars are interleaved with each other.