improved isActive helper to check subpaths