Merge: serialization: fix a bug, improve doc and clean weird condition