Added guard against undefined visible property