got casting inside serialization working