fix a memleaks