pass db to reverse_indices