Critical fix for end of day infinite loop
Merge branch 'master' into ST3