Fix 100% CPU bug