fixing incorrect buffer size allocation, and unsafe integer size type