fixed insertDictHistory function

experimental, need to test