Fix memory initialization issue - potential crashing bug