Old proto authentication fix

This should fix the problem. For simplicity please review commits separately.