some error handling for fs.dir(...) == nil