"I've decided to call him [= little dragon] Norbert," said Hagrid, looking at the dragon with misty eyes. "He really knows me now, watch. Norbert! Norbert! Where's Mummy?"
"He's lost his marbles," Ron muttered in Harry's ear.
"Hagrid," said Harry loudly, "give it two weeks and Norbert's going to be as long as your house. Malfoy could go to Dumbledore at any moment." Hagrid bit his lip.
"I –– I know I can't keep him forever, but I can't jus' dump him, I can't."
Harry suddenly turned to Ron.
“Charlie,” he said.
"You're losing it, too," said Ron. "I'm Ron, remember?"
"No –– Charlie –– your brother, Charlie. In Romania. Studying dragons. We could send Norbert to him. Charlie can take care of him and then put him back in the wild!"
(Harry Potter and the Sorcerer's Stone)
Being the referent of ‘it’ is ‘marbles’, I’m wondering why it is not ‘them.’