improve code

1. file.filepath -> file.path
2. pass pkg as an argument to lookupFiles
3. imporve debug