A Midrash explained why the sons of Korah were saved. When they were sitting with their father, and they saw Moses, they hung their heads and lamented that if they stood up for Moses, they would be showing disrespect for their father, but if they did not rise, they would be disregarding "You shall rise up before the hoary head." They concluded that they had better rise for their teacher Moses, even though they would thereby be showing disrespect for our father. At that moment, thoughts of repentance stirred in their hearts.