Ok, level 18 is ok and gives the correct code. Finished level 24, at the start of the level 25 it gives me the same level 24 code. So I have to restart always from level 24 if I want to play level 25 and more:
Finished level 24 I have always the problem with the code for level 25 wrong (it's for level 24):
On Level 25 there are few arrows (even saving a lot from shoot to some stone, or discovering some hidden arrows), so I cannot shoot enemies to fill the energy for the key: