Fixed head/tail issues