Small modification to the writing of the history file