fix segfault problems because of ctypes restype