add rebuild db function