fixed bug in add()