Fix bug caused when restarting server