Fixes #1346 Indexes SQL errors
Merge pull request #1360 from Stefan-ST/fix-1346

Fixes #1346 Indexes SQL errors