update history function