Added undefined check in the case the checkbox is not found