Add the check for empty filenames