Fix tests and format