remove some memleaks.