refreshed the code from sequelize/master v.1.7.0