Reverting move of lock
Fixed merging_map & test.