use strtol() instead of sscanf()