minor bugfixes + complete test suite