Bugfixes & new tests.