prevent modulo, use counter