fixed some server errors and handles when a player ends a game