Minor fix to the "isVisible()" method, fixing a race condition.