function to remove useless and forbidden links added