fixes head and tail