fixed jsgate deallocation