Fixed vector::erase misuse.
Fixed OSX not compiling.