Fixing bugs and making the integration_test pass