fix bugs in history upload