fix checkbox erratic behavior in some cases