[fix] some edge case bugs
[test] restructure the testsuite