add destroy function for globals