Fixed up tail() and tests