detectWonState fixed + test