Fix CursorIndexOutOfBoundsException, selection clause for query