revise some bugs in implementation