fixed bug with authentication procedure