Change the algorithm of imageCount.