Fixed another memory leak and a crash