fixed adding barostate before writing system.xml