the claim: IAN MCKELLEN (GANDALF) HIT HIS HEAD AGAINST THE BEAM BY ACCIDENT.
It was kept in the movie because Peter Jackson thought that McKellen acted so well through the mistake.
But According to mckellan.com it was Mckellan's idea to do so and just seemed spontaneous.