Delete selected lines (with potential index out of bound bug )