Fix serialization of null and undefined values