fix a couple of bugs when adding tags