fix aggressiveVariableElimination bug and add testing