fixes memorize history undefined, adds changes from previous commit