replaced sscanf by atoi