Fixed some memleaks