improve buffer initialization