Some memory-leak fix(not all)