Changes to Stream.collect() to try and solve the intermittent failure problems. Adding synchronization around the buffered values to guarantee exclusive access. Not very non-blocking, but better than intermittent race conditions.