Improving the Security of Quantum Protocols