removed strndup usage