Fixed behaviour for nullable types and enums in XML serialization. Also made serialization more compact.