logic error in add