Change of DB rebuild logic