Ctypes from ptr fix (0.2 branch)