Check :manifest before using default :main.

Fixes #1736 and probably #1710.