added debug code for night refresh