use strtok_r instead of strtok

strtok isn't thread safe, no reason not to use strtok_r