more fmemopen null termination fixes