Problem: strndup is not available on all system

Solution: revert to previous duplication code