Move some catch definitions around to avoid an import loop