fix buffer initialization