slowly but surely, getting getting rid of the memory errors, the final \0 allocation is troublesome