update test code to more compatible