Fix visibility detection