fix clearoptionalTail for 2.x branch