Fix some rather ugly special cases.