Object serialization and some tests