fixed a bug where the game ended incorrectly upon death