rework integration tests
create integration tests

+ various bug fixes