Fix head and tail partial bug