cleanup storage of entity ids on the server, added improved checks for server vs client
some various fixes