detect start and end game