fix the logging and authentication procedure