added some missed buffer handling