fixed bug with db swap