fix multiple bug in stream and restart - fixed #14