bugfixes, functional tests.