fix end game bug