* Fix database merge algorithm #2223