fixed the limit calculation