fixed the memory leak!