Fixing pending tasks bug in history