Fix scope lookup (bottom-up)