Fix bugs and Apache integration tests
Fix a crash