Added index check for unit tests.