fixed a couple of bugs in Adding routine