Fixed login code and few other changes