Bug fixed

Search logic bug fixed. Indexes are assigned correctly to matches in
the array, matches are collected and destroyed for single (x, y) set.