Improve stability of unit test