Added a check for visible element