Fixed duplicate history writing.