Fix serialization of maps with null values

Serializing an object with a dynamic map containing a null value would throw a "Serialization of null is not supported" exception.