fixed nullpointer exception when history was empty