updated file/dir perms checking