fix seg fault due to memory allocation goof.