fixed bug when server stops