fix to isInside function