fixing race condition in stream prototype :perservere: