I didn’t chnage anything. I used your script as is and every step of the debugging worked as predicted. Maybe deleting the preference did it.
Yes, it is probable then that in earlier trials, the preference file had become corrupted. My next step would have been to ask you to zip it and send it to me so I could see whether it was screwed up.
Glad you’ve got it running.