fix erase returned True inside for loop