fixed bug where matching cursor instead of the value at array[cursor]