improve layer constructor string handling

use strdup to avoid the REPLACE_STRING macro.