Better heuristic for name generation backward compatibility. We fallback
to old behaviour whenever we were in Program mode.