s4:repl - change also here the counter variables to "unsigned"