Fix NIF to avoid any non-reentrant functions.