Director Jonathan Levine reveals McAvoy had to quit the project following "a family emergency".
The filmmaker says, "It was really, really tense and scary for a couple of days. We didn't really know what the fate of the movie was and we were worried for James.
"Once we found out he would not return we found Joe and he was a great choice. Joe saved this movie in many ways."
Levine also had a last-minute title change: "The original title was I'm With Cancer, which I didn't think was the most commercially viable way to go. As someone who has been through cancer with family members I wouldn't want to get two tickets to see a film called that. We had a huge title search and at the end of the day 50/50 won out."