bug in tail method