Bug fix for historyLen problem after history deletion and history updation