fixed a problem that was caused by serializing a sub-element (constraints) before serializing attributes