Fix tests and formatting issues