Added legacy code to prevent gates from losing contents