Fixes for crashes on Linux.

- Fix erroneous std::list::erase() usage.
- Missing #includes.