fix native module constructor

Would have cached the values in the wrong place.

(cherry picked from commit e3b292e08e10986af627fc67a5bed18fecc0f849)