Changed link behavior for folders

In previous version folders were not correctly linked, leading to
erroneous behaviour