fix gh-1344. Scan opt error/warning.
Merge pull request #1451 from nouiz/scan_1344

[WIP] fix gh-1344. Scan opt error/warning.