Fixed some errors with the serialization