isFile check added