Fix a bug on swap_head_tail option.