Front Master cylinder leaking

I noticed my master cylinder leaking brake fluid . The screws were not overly tight , so I tightened them but it still leaked. so I took the cap off and the rubber diaphragm seemed folded up like an accordian, so I took it out and put it in the normal position. now when adding brake fluid do you take the rubber diaphragm out to fill it ., then put the diaphragm back in and tighten it down. not sure why the diaphragm ended up distorted like that. I have never touched it otherwise, only the dealer.