Adding some tests and fixing some integration tests