decode now uses the canonical tree