fix buffer initialization bugs - breaking ubunut version