After bad times came to Job, what could he have done differently? The only thing I can think of is be slower to speak. Should he have put up with people talking bad about him? I think so. Should he have moved or run away to a place where everyone agreed with him? No.
He had a time where, no matter how much he repented or tried to change his position, he was going to suffer. The only right thing to do was to take it patiently. “…but if, when ye do well, and suffer for it, ye take it patiently, this is acceptable with God.” (I Peter 2:20)