fix segfault and memory leak
forgot a few string nulls
merge