remove all the CURDIR's that are not necessary