correction on path management, little refactoring