refactoring to the emitting logic.
check for emit config property is isolated from save config property. Work now at two different phases.
fixed tests to adapt to the new behaviour resulting from isolating ctx.config.emit and ctx.config.save.