In Harry Potter and the Half-Blood Prince, on board the Hogwarts Express, Harry puts on his Invisibility Cloak and sneaks up into the luggage rack in the compartment where Slytherin students are gathered so that he can spy on Draco Malfoy. Malfoy notices Harry is there and when the train arrives at Hogwarts Draco fires the Petrificus Totalus spell towards Harry. The spell hits Harry and he falls to the floor. My problem is that in Deathly Hallows, we learn that Harry's cloak is a Deathly Hallow and part of its magic is to make the wearer totally invisible, meaning that even spells (except something like a Killing Curse) have no effect on the wearer. This was even witnessed when Harry, Ron and Hermione Apparated into Hogsmeade and set off an alarm letting the Death Eaters know he was there. One of the Death Eaters immediately shouted "Accio Cloak", using a summoning charm to pull the cloak right off Harry. As the cloak is a Hallow, however, the spell had no effect whatsoever and stayed around Harry and his friends. So how was a relatively simple spell such as the one Draco used able to penetrate the cloak and hit Harry?