Apply configuration changes via TMPFILE
Substitute configs more granularly to fix #1