bug fix for reading path and add condition "isFile"