It's an easily reproducible bug. I just created a new game, bought three slaves, manually edited their names to be the same, raped them all (decr. happiness), and gave the first a bag of sweets (+10 happ, part of LordShame's item pack). The result: the last girl got a happiness increase, rather than the one I gave it to.
Why it happens, I don't know. But it does happen.
Edit: Oh, I see what the problem is. When you press "Give Gift", that part is tracked by name. So if I had three "Riyos", and press "Give Gift" on the first, the one selected on the screen that comes up is the always the last match of the same name, rather the one the button was pressed on.
So it's not a problem internally--just that of interface.