def fix buffer