this code is within LEGACY_EXEC ifdef and should not be touched.