fixed bad module reference count issue (crash on exit)