fix bug with link and add a few small changes