yes. what you did was you used a condom incorrectly, and when you use them incorrctly, you can't expect them to work.
so in the future, if it goes on backward, take it off and start over. this is why you buy an excess of condoms. they're cheap and easy to store, so there's no excuse not to have a whole crapload of them.
since oyu have both a pregnancy risk and an STD risk, you and your boyfriend should get full screens, and oyu sohuld see a clinician, explain what happened and see about getting emergency contraception. You can find a Planned Parenthood clinic by calling 1.800.800.PLAN or you can report to your local hospital emergency room.
Summertime, and the living's easy...