Make Profile.init more flexible (fix #7365)