Sunset schedule updates before sunset occurs

Need some help… I’m following the sample code for Taking Action Before/After Sunset but the turnOn event never fires up.

Looking at the SmartApp event logs I found out that the Sunset schedule resets every day (for the next day sunset) before [Sunset time+Offset] reached. So everyday, just before the scheduled event time, the new Sunset event schedules for the next day and the switch never turnOn:

Log Date | Scheduled Event
2018-01-18 4:48:01.349 PM PST | Turning on lights @ Sat Jan 20 01:40:00 UTC 2018 (= 2018-01-19 5:40PM PST)

2018-01-18 12:55:52.233 PM PST | Turning on lights @ Fri Jan 19 01:38:00 UTC 2018 (= 2018-01-18 5:38PM PST)

Can someone suggest a solution?
Thanks in advance!