Fix high CPU usage in rare conditions.