fix unit test, improve integration test