Merge configuration properly. Closes #978.