Fixed method to generate instance xml