Fixed bug with canonicalization.