feature #2054: Free encoded string in aes encryption. Move token path to history. Minor changes