Fix mocks for tests and add some new tests