char set change, loop for store/restore added