           articleFile = articlesDir + '/' + file
           Article.fromFile articleFile, encoding, (err, article) ->
             if !err
-              permalink = article.permalink true
-              cache.articles[permalink] = article
-              cache.listing.push permalink: permalink, date: article.date()
-            loadNext()
+              fs.stat articleFile, (err, stats) ->
+                if !err
+                  permalink = article.permalink true
+                  cache.articles[permalink] = article
+                  cache.listing.push permalink: permalink, date: article.date()
+                loadNext()
         else
           cache.listing.sort (a, b) ->
             if a.date < b.date

  constructor: ->
    @readyEmitter = new events.EventEmitter()
    @readyEmitter.once 'ready', () -> true # temp. fix for node issue #792
    @readyEmitter.emit 'ready'
    @readyEmitter.setMaxListeners 0

  build: (articlesDir, encoding) ->

  # Default paging to 10
  configs.perPage ?= 10

  # Default rebuild secret
  configs.rebuildSecret ?= 'typhoon'

  # Setup base url and data paths
  Article.baseUrl configs.baseUrl
  exports.cache.build configs.articlesDir, configs.encoding || "utf8"
