Fix infinite loop on save