Make sure to keep the same entry only once in the history entry

This fixed bug #615.