fixed history encoding issues