fixed -1 SQL index error #266