bug fixes to API