FIX use pointers in place of memoryviews and check for null parent