Fix Issue 3594 (factor should return unhandled expr unchanged)