libraries: imrpoved to_dict handling; corrected unencoded ID treatment; eceptions refactoring for API; docs