fix bugs in test and add new test