Fix memory cycle when server is used