fix duplicate runs on checkbox
few modifications as suggested by Brito