 
         # queries
         writeLogtime = log.time 'Save styles'
-        stack.runAllSimultaneously ->
+        stack.runAllSimultaneously (err) ->
             log.end writeLogtime
+
+            if err
+                return callback err
 
             currentQueries = null
             mergeQueries = ->

IN_DIR = './styles'
OUT_DIR = './build/styles'
QUERIES = './build/styles/queries.json'

getQueryPriority = (val) ->
    Document.Element.Tag.query.getSelectorCommandsLength val

queriesSortFunc = (a, b) ->
    b.dirPriority - a.dirPriority or getQueryPriority(a.query) - getQueryPriority(b.query)

module.exports = (platform, app, callback) ->
    fs.ensureDir OUT_DIR

    filesToLoad = 0
    files = []
    filesByFilename = {}

    inputDirPriorities = {}
    inputDirs = [
        {path: pathUtils.join(__dirname, '/styles/default'), prefix: ''},
        {path: IN_DIR, prefix: ''}
    ]

    packageConfig = JSON.parse fs.readFileSync('./package.json', 'utf-8')

    # add package module extensions
    for key of packageConfig.dependencies
        stylesPath = "node_modules/#{key}/styles"
        if /^neft\-/.test(key) and fs.existsSync(stylesPath)
            inputDirs.unshift path: stylesPath, prefix: "#{key}/"

    # add local extensions
    try

            if files.length is filesToLoad
                onFilesReady()

    onFilesReady = ->
        newQueries = {}
        stack = new utils.async.Stack
