Fixing serialization of endpoints