Some more fixes for the ctypes backend