working on fix for head/tail