Revive and fix code related to static method compilation
Move alterVarRoot special case to static method compilation