Discovered 2 bugs - added unit tests.