possible fix for strtok_r

also added debug print line