rewritten limit check