Fix lexical scope detection.