Fix bug with authentication reported by Martin Aryee.