Fixed bugs with variable declarations and when search pattern has an exact match.