fix bug of crash on reload
Merge pull request #1125 from richardcypher/fix_crash_onreload

[test]fix bug of crash on reload