Added update time checking and bug fix.