Fixed exception when stopping server