fix bug with counter when the number given is not int