improved thread safety of call sequence
improved a test case.