solve the tail problem

solve the tail problem