Resolve weird ctypes bug in tests