fix error on dirs and non-files via stat check