Fixed #148. Fixed sorting in history.