Fixed bug in calculating refresh tims.