improve multiple db support