When the Magi had gone, an angel of the Lord appeared to Joseph in a dream. Get up, he said, take the child and his mother and escape to Egypt. Stay there until I tell you, for Herod is going to search for the child to kill him. So he got up, took the child and his mother during the night and left for Egypt, where he stayed until the death of Herod. And so was fulfilled what the Lord had said through the prophet: "Out of Egypt I called my son." When Herod realised that he had been outwitted by the Magi, he was furious, and he gave orders to kill all the boys in Bethlehem and its vicinity who were two years old or under, in accordance with the time he had learned from the Magi. Then what was said through the prophet Jeremiah was fulfilled: "A voice is heard in Ramah, weeping and great mourning, Rachel weeping for her children and refusing to be comforted, because they are no more.
The thing is Herod the Great was born 74/73 BCE and died in 4 BCE (aged 70), according to Wikipedia. I know that Wiki is not a credible source at all and that's exactly why I'm asking this question.
Assuming that he died 4 BCE, that means he died 4 years before Jesus was born so he couldn't have committed the massacre. I must be missing something, what is it? If Herod the great didn't commit the massacre, who did? If he did commit the massacre, when did he die?