Fixed serialization bugs