Fix a bug occurring when using wrap_line option and swap_head_tail option at the same time.