improved doc, fix bug