minor bugs fixed
fixed addlinks function