Fix a bug in the range remover