Fix logic to hide/show link