Fixed area check and added isVisible check