index: fix removing the "selected" class from previous selection