Fix iterator erase() problems
Use pre-increment for iterators
Merge pull request #132 from po1/fix-iterators

Fix iterator-related things