Comparison of the photochemical and thermal rearrangement reaction of endoperoxides