Fix tests and formatting