updated watchdog code