fixed the problem of buffer filling up