fix a few bugs and add CLI tool
update readme