serialization and bug fix