BUG: fix nested dict replace

closes #6342