Forward-port start-of-day fixes from 5.4 tree