Fixes and additional unit-tests.