add states and improve set avatar