Fixed bugs in integration test