Fixed configuration overriding

The deep merge was made the wrong way around
Added initial test coverage
Merge pull request #1022 from gkarekinian/patch-2

Fixed configuration overriding