Have done this myself before, confusing 2 players in my mind, and sending off for a first caution. I'd done the offending side the week before so the player had stuck in my mind.
I too was able to correct my mistake when reviewing my notepad, thankfully.