get rid of some push_external calls and much of lua_ref usage