code fixes for serialization and other issues