Fix 100% CPU usage