Fix failing tests and add more tests