fix ever-increasing buffer