Implement fixes for using local DBS

Needs fixes in WMCore. Do not merge it yet