       maxDeps = queue[q].require.length
       curDeps = 0
 
-      (curDeps++ if cache[d]) for d in queue[q].require
-
+      for d in queue[q].require
+        depBasename = d.split('!')[0]
+        curDeps++ if cache[depBasename]
+      
       # Reload module and delete item from queue
       if curDeps is maxDeps
         modName = q

      if cache.hasOwnProperty(i)
        cacheDeps.push cache[i]
      else
        # If a '#!' is put in front of the dependency, it will assume the module is in the same script file
        if root.molo.scriptLoader or i.indexOf('#!') isnt 0
          if isJavaScriptFile(root.molo.paths[name])
            # If the path is complete (e.g. 'js/lib/mymodule.js') take that as a path
            scriptPath = root.molo.paths[name]

    delete cache[name] if cache[name]
    delete queue[name] if queue[name]
    
  # Provide plugin functionality
  root.molo.plugins = {}
    
  # Shorthand function to load script files
  root.molo.main = (dependencies) ->
    dependencies = [dependencies] if typeof dependencies is 'string'
