Revert "Revert "fixed crash issue""

This reverts commit 7af3e9de8c88fa0fb1c920e1fe053fc16b047f55.