Fixed errors in detecting variables prior declarations inside functions.