Entity serialization fixes