Fix redirect loop in canonicalization