Fix undefined history bug.