fixing error when there is no files in the directory yet