Fix tests and other issues