implemented server correct shutdown