Fix issue #447

Also re-formats the code around the affected function according to the Sequelize code style.