Update unit test.
fix possible null pointer expection