fix counting in rake task