add login and repeat and some bug fix