Fix target directory according to defined tree