When an adverb clause comes in the middle of what it modifies, it takes commas around it. When the element it modifies is inside another dependent clause, the adverb clause still takes commas around it.
...He will be given a fine unless, when he calls, he gives us a reason for his absence.
...I left the company because, though I had been there for 20 years, I did not feel appreciated.
...I met a man who, after we talked for a while, seemed perfect for the project.
...We were with a cousin who, if you want a dynamite employee, is the person for you.
And when the adverb clause comes in the middle of a "that" clause, it has commas around it even when the "that" is there twice or is not there at all or is in front or is in back.
... I don't remember that, when I was there, he asked that question.
... I don't remember that, when I was there, that he asked that question.
... I don't remember, when I was there, that he asked that question.
... I don't remember, when I was there, he asked that question. Happy punctuating! Margie
... I don't remember that, when I was there, that he asked that question.
... I don't remember, when I was there, that he asked that question.
... I don't remember, when I was there, he asked that question. Happy punctuating! Margie