switched from atoi() to strtol()