Rule reminder
The gerund requires the SAME subject as the main verb. If subjects differ, use a subordinate clause (mentre/quando/perché/sebbene) instead of a gerund.
Which is correct: same subject for both verbs?