fix case when history is empty