Fixing some small bugs in 3-legged authentication