Fix bug

@pezy 's modification on @wgqimut.
A comment about Erase-remove idiom.