Fixed some major memleaks