fix empty stream bug