Section 15 Whenever, according to the provisions of the law as provided afterwards, any punishment has been changed to be a measure of safety, and there is a judgment inflicting such punishment on any person, it shall be deemed that the inflicted punishment is also a measure of safety.