fixes #2099 - fix handling of multiple module paths

Replace every occurrence of $confdir, not only the first one
fixes #2099 - interpolate $confdir if $environment not used