Memory Leak and 100%CPU usage fixed