fix a timing of opening buffer