Fix for nested substitutions for MG_SUBS. Added tests for MG_READ_CONFIG for where this came up.