handle error in asynchronous api, fix issue #1
update docs and publish