fixed authentication and other bugs