Fixed matching algorithm bugs.

Cleaned up order of operations to fix a vita-only crash caused by a null
reference that was time-dependent.