may the strtok is the problem... i wouldn't believe in that function anymore. use sscanf instead.
There is nothing wrong with strtok it's just out dated....so i would still believe in that function if you wanted a godfather edit or something and didn't feel like converting all the commands.