make sure index exists, before removing doc