bugfixes, integration test