fix head_and_tail for good