Fix small memleak and make sure the numeric strings are null terminated