Some fixes for ctypes bindings