Fix failing tests and add a new test