fixed bugs to make login to work