fixed sequence reset

Fix for this issue https://github.com/yiisoft/yii2/issues/1646. Also related with https://github.com/yiisoft/yii2/pull/1648.