fixed memset crashing bug