Fix imports
Use explicit self
Wrap C function call in unsafe block