corrected js script to properly initialize checkboxes on refresh