Fixed bugs in range and remove