[bugfixes] Bugfixes, tests, doc