fix scoping bug when compiling directory
fix path issue when compiling directory