I was told that the following sentence was incorrect because the participle clause has a different subject:
"When deciding punishments for crimes, criminals' intentions are important."
If that's true, then is the following sentence, which I think sounds quite natural, also incorrect?
"When creating a nutrition plan, age is an important factor."
Any help would be greatly appreciated.