This bug has been fixed in github but has not been released in the official version. As of now, the latest version is 2.0.13.1
Here is the commit in github that fixes the issue
https://github.com/yiisoft/yii2/commit/1958d8bff2d7887e77db4ebe0e2e81500ff4363f#diff-7a9208d78ae9e05143782a4a99b017bf
If you want to use this patch now, you can install the code from the master branch
This is written in composer.json
"yiisoft/yii2": "dev-master",