test erase in loop