Try to fix some bugs that happen on server restart