modify C extension to Ruby