Updating C extension

Updating C extension accordingly to #1030.

(Request from @fabpot)