fix potential crashing bug related to incorrectly initialized memory