moved all unnecessary unlinking