BUG: Make sure that head/tail are iloc based, (GH5370)

closes #5370