Fix Login and register function