Fixes problem with checking all submatrices, but not in a very good way.

Need a better way to interrupt waiting on the queue, as interrupting the thread causes problems