added new integration tests and fixed some bugs