Fix bug with 100% CPU load