Reorder some recursive definitions to avoid undefined references.

Please include in v6.1 release if possible.