Fix incorrect removal of visibility when combined with static