fix severe memory leak