fixed memory leak with path and added more warning in compiling