Revert "Fixed unit test crash."

This reverts commit 261b156a893afc916c3a2391643bad17983ac597.
Fixed unit test crash properly.