Fix for whenending at midnight