doc: update .ret type
numerous bug fixes