Added logic for local static vars.