Memleaks fixed