I'm not sure whether you need to initialize the state (checked, etc) early at this stage.
You could do so (and probably already do) it later at the time where the dialog appears.