Fix deadlock when restore stream is not used. Fix #19