[extensions] Fix NSphere compilation issues.

The fixes are rather temporary workarounds (see comments in the code).