Fixed a cpu usage issue
Fixed a potential crash