Some bug fixes and added WDT