fixed errors with vector::erase