1. merge CaoGong's code to fix crash issue.