use strdup instead of casting to char*