Fix tests and ambiguity warnings