fix bugs: add dependencies, fix unit test