FIX as_index for head and tail