check remove for indexes other than 1
set cur outside of if statement

When removing indexes other than 1, cur would not be set which would
lead to (logic?) errors.