I had a similar problem with a car that I bought long ago. After a lot of messing around, I found that the previous owner had replaced the vacuum booster on the master cylinder with one that was not correct, even though it looked the same. Once I changed it, everything worked fine.