improve test interface and fix some minor bugs