will fix crash and memory leak.