only add main if needed