Replaced strdup with strcpy to avoid memory leaks