Added 2 more integration tests and fixed related bugs