from my experience with the C++ API, including debugging problems until I find that they were indeed issues that eventually got fixed upstream, the API is poor and any combination of functions that were not explicitly tested is likely to not work correctly and trip you up.