it works with the selection. There is still a bug with the index