fixed bug: tail add not setting tail correctly