More tests and associated fixes