Fix resource wrappers + low-level C