fix code style problem and rewrite the testsuite for simplicity.