In the old testament, when people die, they did not go to heaven or hell. They did what the Bible terms as: slept with his fathers. Which basically means that your soul stayed with your body. Being that there was no punishment for sin after a person died in the OT, that punishment was carried out on earth instead. And the reason children were included in this punishment was because the sins of the father affected the whole family, This is why the Bible warned fathers about this. But people don’t listen, so the suffering will be their fault. Christ making a new covenant where everyone went to where they are supposed to (no more slept with the fathers) changed all that. The punishment for sin is now “after death” instead of before it. Just do a Bible search in the OT on the words: “Slept father”. And you will see several verses on this.