add watch dog code