try an anonymous onstatechanged fn instead