- Fix crash.
- Add tests.