Fix object property merging in shape serialization. Add tests.