title: Wrong executing order with NodeJS callback based function in promise chain
body: <p>I'm trying to use a callback function in a promise chain. Actually the original code is divided into two files and contains a lot more code, but to make the problem clear I've simplified it into one simple file.</p>
  
  <p>I'm expecting the following code to produce: A B C D E F, but instead I get: A D B E C F. I can't understand why D gets called before B, and how to make the code work as expected! </p>
  
  <p>When I'm not calling any callback based function and just use Q.async functions then it is working as expected!</p>
  
  <p>Here is the code:</p>
  
  <pre><code>var Q = require('q');
  var FlakeId = require('flake-idgen');
  var biguint = require('biguint-format');
  var flakeIdGen = new FlakeId({ id: 0, epoch: 1234567891234 });
  var idDec = null;
  
  var deferred = Q.defer();
  var createId = function() {
    console.log('A');
      flakeIdGen.next(function (err, id) {
        console.log('B');
        if (err) {
          console.log('Error 1');
          deferred.reject(new Error(err));
        } else {
          idDec = biguint(id, 'dec');
          deferred.resolve(idDec);
        }   
      }); 
    return deferred.promise;
  };
  
  var doSomething = Q.async(function* () {
    console.log('D');
  });
  
  createId().then(function(idDec) {
      console.log('C');
    }).fail(function(err) {
      console.log('Error 2');
  }).then(
  doSomething().then(function() {
      console.log('E');
    }).fail(function(err) {
      console.log('Error 3');
  }).then(function() {
    console.log('F');
    }
  ));
  </code></pre>
  
  <p>Any help appreciated. Thanks.</p>