Fix programs crossing midnight