fix some bugs in tests