Small fixes and cleanup for c++ wrapper