fixing terminal history (multiple terms save)