fix buffer output