Fix server loop