     )
 
   _populateGrammars: (grammarsFromJSON,grammarsArray,cb) ->
-    toLoad = grammarsArray.length
+    toLoad = (grammarsArray||[]).length
     grammars = []
 
     done = (err,grammar)=>
       if err
         return cb(err)
 
-      grammars.push(grammar)
+      if grammar
+        grammars.push(grammar)
 
       if !--toLoad
         # complete loading from grammars.json

        else if stat.isDirectory()
          packageDir = modulePath
        else
          # return with no error at all if i cant find the module dir...... copying the sync impl. =(
          return cb()

        @_registryLoadGrammarsDir(packageDir,cb)

      )



        cb(false,true)
   
    if(!toLoad)
      toLoad = 1
      return done()

    while grammarsArray.length
      @registry.loadGrammar(grammarsArray.shift(),done)

