disable metatable hiding to allow a lua 'casting hack' to work. Fix up initialization/destruction order so that resources get released in the order they were created.