yes, it's kind of a difficult situation to manage, but the skater who is waved off from the box should be waved in once her teammate is released. The skater who 'owes time' in the box should be compelled to play in the following jam, if necessary, so that her time will be properly served. Head ref has to keep his/her eye on this.
if the situation with more than two in the box looks like it will only last <10 seconds, then the box can be temporarily 'overpopulated'. GGRD has had a few of these kinds of moments this season.