Fix broken tests and inconsistencies.